package globox_db_server;

import java.rmi.Remote;
import java.rmi.RemoteException;

import utils.jn.Sit;
import utils.jn.TheaterSit;

/**
 * Interface para o cliente da base de dados
 * 
 * @author Joao Nuno
 * 
 */
public interface BoxOffice extends Remote {

	/**
	 * 
	 * @return
	 * @throws RemoteException
	 */
	public Iterable<String> getTheaters() throws RemoteException;
	
	/**
	 * 
	 * @return
	 * @throws RemoteException
	 */
	public Iterable<Sit> getSeatsByTheater(String t) throws RemoteException;

	/**
	 * Make a reservation for a theater session
	 * 
	 * @param session
	 *            The name of the session to see
	 * @param transactionID
	 *            The ID for the transaction
	 * @return The reservation object with the new state of the room
	 * @throws RemoteException
	 */
	public Iterable<Sit> makeReserve(String session, int transactionID)
			throws RemoteException;

	/**
	 * Make specific reservations for a theater session
	 * 
	 * @param session
	 *            The name of the session to see
	 * @param transactionID
	 *            The ID for the transaction
	 * @param sits
	 *            An iterable structure with the sits to reserve
	 * @return The reservation object with the new state of the room
	 * @throws RemoteException
	 */
	public Iterable<Sit> makeReserve(String session, int transactionID,
			Iterable<utils.jn.Sit> sits) throws RemoteException;

	/**
	 * Commit the transaction
	 * 
	 * @param transactionID
	 *            The id of the transaction
	 * @return True if the purchase was made with no errors
	 * @throws RemoteException
	 */
	public boolean commit(int transactionID) throws RemoteException;

}
